package com.warm.base.design.c_singleton;

/**
 * @Date: 2019/11/21 17:06
 * @Author: LChuang
 * @Description:
 */
public class EnumSingleton2 {

    /**
     * 私有化构造函数
     */
    private EnumSingleton2(){}

    /**
     *  4.2 枚举
     *  *** 最佳的单例实现模式 ***
     */
    /**
     * 定义静态枚举类
     */
    static enum SingletonEnum{
        INSTANCE;

        private EnumSingleton2 singleton;

        private SingletonEnum(){
            singleton = new EnumSingleton2();
        }

        public EnumSingleton2 getInstance(){
            return singleton;
        }
    }
}
